/*
 * @Author: qianmingtian
 * @Date: 2020-07-09 15:56:09
 * @LastEditors: qianmingtian
 * @LastEditTime: 2020-07-09 18:09:09
 * @FilePath: \qianmingtian.github.io\code\java\SortAlogrithm\PaoPaoSort.java
 */
package SortAlogrithm;

public class PaoPaoSort {

    public static int[] sortByPaoPao(int[] arr) {
        // int[] arr = { 123, 34, 5, 6, 21, 6543, 231, 6453, 213 };
        for (int i = arr.length - 1; i > 0; i--) {
            for (int j = 0; j < i; j++) {
                if (arr[j + 1] < arr[j]) {
                    arr[j] = arr[j] + arr[j + 1];
                    arr[j + 1] = arr[j] - arr[j + 1];
                    arr[j] = arr[j] - arr[j + 1];

                }
            }
        }
        
        return arr;
    }

    public static void showArr(int[] arr){
        for(int i : arr){
            System.out.print(i + "  ");
        }
    }
}/*
  * @Author: qianmingtian
  * 
  * @Date: 2020-07-09 15:56:09
  * 
  * @LastEditors: qianmingtian
  * 
  * @LastEditTime: 2020-07-09 15:56:09
  * 
  * @FilePath: \qianmingtian.github.io\code\java\SortAlogrithm\PaoPaoSort.java
  */
